package com.dianganjiao.lib.http

import com.dianganjiao.lib.event.LoginEvent
import org.greenrobot.eventbus.EventBus

class TokenBadErrorInterceptor : HttpErrorInterceptor() {

    override fun loadDataFailedInterceptor(code: Int, e: Throwable):Boolean {
        if(code == 401 || (e.message != null && e.message!!.contains("未登录"))){//token过期/需要登录
            EventBus.getDefault().post(LoginEvent())
        }
        return false
    }
}